<HTML>
<HEAD>
<TITLE> Generate Password</TITLE></HEAD>
<BODY>
<!-- This way the extension and website can use the same logic -->
<Script src="extension\findPass.js"></script>
<script>
/*Function is called when the button is clicked.
The form object contains the following fields:

*/
function genPass(form)
{
	var url = form.url.value;
	//the local key/ certificate will be be generated when extension is 
	//installed, but for now will use hard-coded string
	var typedPassword = form.typedPassword.value;
    var extensionPassword = form.extensionPassword.value;
    extensionPassword = CryptoJS.SHA256(extensionPassword).toString();
    //console.log(extensionPassword);
    var password = genPassword(url,typedPassword,extensionPassword);
    form.passwordGen.value = password;
}

</SCRIPT>
<form>
    <!-- added initial values to make debug faster -->
	<p>Typed Password:<input type="password" name="typedPassword" value ="cats" ></p>
    <p>Webpage URL:      <input type="text" name="url" size="50" value = "https://www.facebook.com/"></p>
    <p>Extension Password:      <input type="text" name="extensionPassword" size="50" value = "MoeLarryCurly"></p>
	<p><input type="button" value="Get Password" onClick="genPass(this.form)"></p>
	<p>Password Generated:<input type="text" name="passwordGen" size ="32"></p>
</form>
</body></html>
</BODY>
</HTML>